package com.hdoit.ares.logical.acti.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import com.hdoit.ares.logical.acti.dao.IActiTaskDao;
import com.hdoit.ares.logical.acti.model.ActiTask;
import com.hdoit.ares.logical.acti.service.IActiTaskService;
import com.hdoit.ares.logical.active.service.ISignService;
import com.hdoit.ares.logical.cust.service.ICustomerService;
import com.hdoit.ares.logical.official.service.IArticalCommentService;
import com.hdoit.ares.logical.share.service.IConsultService;
import com.hdoit.ares.logical.viewmodel.acti.ActiTaskSearch;
import com.tennetcn.common.dao.base.impl.SuperService;
import com.tennetcn.common.message.PagerModel;
/**
 * @author      caochengmeng
 * @email       
 * @createtime  2018年03月14日 08:40:41
 * @comment
 */
@Component
public class ActiTaskServiceImpl extends SuperService<ActiTask> implements IActiTaskService{

	private ICustomerService customerService;
	private ISignService signService;
	private IArticalCommentService articalCommentService;
	private IConsultService consultService;
	
	
	public IConsultService getConsultService() {
		return consultService;
	}
	@Resource
	public void setConsultService(IConsultService consultService) {
		this.consultService = consultService;
	}
	public ICustomerService getCustomerService() {
		return customerService;
	}
	@Resource
	public void setCustomerService(ICustomerService customerService) {
		this.customerService = customerService;
	}
	public ISignService getSignService() {
		return signService;
	}
	@Resource
	public void setSignService(ISignService signService) {
		this.signService = signService;
	}
	public IArticalCommentService getArticalCommentService() {
		return articalCommentService;
	}
	@Resource
	public void setArticalCommentService(IArticalCommentService articalCommentService) {
		this.articalCommentService = articalCommentService;
	}
	private IActiTaskDao actiTaskDao;
	
	public IActiTaskDao getActiTaskDao() {
		return actiTaskDao;
	}
	@Resource
	public void setActiTaskDao(IActiTaskDao actiTaskDao) {
		this.actiTaskDao = actiTaskDao;
	}

	@Override
	public List<ActiTask> queryListDayTask() {
		return actiTaskDao.queryListDayTask();
	}

	@Override
	public List<ActiTask> queryListMonthTask() {
		return actiTaskDao.queryListMonthTask();
	}

	@Override
	public List<ActiTask> queryListWeekTask() {
		return actiTaskDao.queryListWeekTask();
	}
	@Override
	public List<ActiTask> queryList(PagerModel pagerModel, ActiTaskSearch search) {
		return actiTaskDao.queryList(pagerModel, search);
	}
	@Override
	public ActiTask queryModelByTaskId(String taskId) {
		return actiTaskDao.queryModelByTaskId(taskId);
	}
	
	@Override
	public String isDayJoinMakered(String customerId) {
		int makers = customerService.queryCountDayMakers(customerId);
		if(makers<1){
			return "maker";
		}
		return "";
	}
	@Override
	public String isCommented(String month, String day, String customerId) {
		int comments = articalCommentService.queryCountDayComments(month, day, customerId);
		if(comments>=1){
			return isDayJoinMakered(customerId);
		}
		return "comment";
	}
	@Override
	public String isDayShare(String month, String day, String customerId) {
		int shares = consultService.queryCountDayShares(customerId);
		if(shares>=1){
			return isCommented(month, day, customerId);
		}
		return "share";
	}
	@Override
	public String isSigned(String month, String day, String customerId) {
		boolean signs = signService.queryIsSignedToday(month, day, customerId);
		if(signs){
			return isDayShare(month, day, customerId);
		}
		return "sign";
	}

}